package com.aaa.config;

import com.aaa.exceptions.CustomException;
import com.aaa.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author : luoBo
 * 自定义异常
 */
@RestControllerAdvice
public class ExceptionConfig{

    // 处理自定义异常
    @ExceptionHandler(CustomException.class)
    public Result<Object> handleCustomException(CustomException e) {
        return Result.error(e.getExMsg());
    }
}
